/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is Forte for Java, Community Edition. The Initial
* Developer of the Original Code is Sun Microsystems, Inc. Portions
* Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.debugger.support;
import org.openide.util.NbBundle;
/**
* Customizer for print action.
*
* @author Jan Jancura
*/
public class PrintActionPanel extends javax.swing.JPanel {
private PrintAction action;
static final long serialVersionUID =-6616273620175320814L;
/** Creates new form PrintActionPanel */
public PrintActionPanel (PrintAction action) {
this.action = action;
initComponents ();
String t = action.getPrintText ();
if ((t == null) || (t.length () < 1)) {
jCheckBox1.setSelected (false);
jTextField1.setEnabled (false);
} else {
jCheckBox1.setSelected (true);
jTextField1.setEnabled (true);
jTextField1.setText (t);
jTextField1.setScrollOffset (0);
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the FormEditor.
*/
private void initComponents () {//GEN-BEGIN:initComponents
jCheckBox1 = new javax.swing.JCheckBox ();
jTextField1 = new javax.swing.JTextField ();
setLayout (new java.awt.GridBagLayout ());
java.awt.GridBagConstraints gridBagConstraints1;
jCheckBox1.setText (NbBundle.getBundle (PrintActionPanel.class).getString ("CTL_Print_text"));
jCheckBox1.addActionListener (new java.awt.event.ActionListener () {
public void actionPerformed (java.awt.event.ActionEvent evt) {
jCheckBox1ActionPerformed (evt);
}
}
);
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.insets = new java.awt.Insets (2, 2, 2, 2);
add (jCheckBox1, gridBagConstraints1);
jTextField1.setColumns (40);
jTextField1.setText (" "); // NOI18N
jTextField1.addFocusListener (new java.awt.event.FocusAdapter () {
public void focusLost (java.awt.event.FocusEvent evt) {
jTextField1FocusLost (evt);
}
}
);
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints1.insets = new java.awt.Insets (2, 8, 2, 2);
gridBagConstraints1.weightx = 1.0;
add (jTextField1, gridBagConstraints1);
}//GEN-END:initComponents
private void jTextField1FocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField1FocusLost
// Add your handling code here:
if (jCheckBox1.isSelected ())
action.setPrintText (jTextField1.getText ());
}//GEN-LAST:event_jTextField1FocusLost
private void jCheckBox1ActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
// Add your handling code here:
if (jCheckBox1.isSelected ()) {
jTextField1.setEnabled (true);
action.setPrintText (jTextField1.getText ());
} else {
jTextField1.setEnabled (false);
action.setPrintText (""); // NOI18N
}
}//GEN-LAST:event_jCheckBox1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JTextField jTextField1;
// End of variables declaration//GEN-END:variables
}
/*
* Log
* 7 Gandalf 1.6 1/13/00 Daniel Prusa NOI18N
* 6 Gandalf 1.5 11/27/99 Patrik Knakal
* 5 Gandalf 1.4 11/5/99 Jan Jancura Add Breakpoint Dialog
* design updated
* 4 Gandalf 1.3 10/23/99 Ian Formanek NO SEMANTIC CHANGE - Sun
* Microsystems Copyright in File Comment
* 3 Gandalf 1.2 8/18/99 Jan Jancura Localization & Current
* thread & Current session
* 2 Gandalf 1.1 7/14/99 Jan Jancura
* 1 Gandalf 1.0 7/13/99 Jan Jancura
* $
*/